<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>add_yihu</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">医护id:</label>
        <div class="layui-input-block">
            <input type="text" id="did" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">医护姓名:</label>
        <div class="layui-input-block">
            <input type="text" id="dname" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">年龄:</label>
        <div class="layui-input-block">
            <input type="text" id="dage" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">编号:</label>
        <div class="layui-input-block">
            <input type="text" id="dnumber" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">诊室名称:</label>
        <div class="layui-input-block">
            <input type="text" id="mname" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">性别:</label>
        <div class="layui-input-block">
            <input type="text" id="dsex" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">在职情况:</label>
        <div class="layui-input-block">
            <input type="text" id="drole" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">地址:</label>
        <div class="layui-input-block">
            <input type="text" id="adress" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">部门编号:</label>
        <div class="layui-input-block">
            <input type="text" id="deptnoid" lay-verify="required" lay-reqtext="不能为空" placeholder="请输入" value=""
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="saveBtn">确认</button>
        </div>
    </div>
</div>
<script src="../../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.jquery;

        //监听提交
        form.on('submit(saveBtn)', function (obj) {

            var index = layer.alert("要更新吗??", {
                title: '确认提交'
            }, function () {
                $.ajax({
                    url: 'http://localhost:8080/worker/updateworker',
                    method: 'post',
                    data: {
                        did: $('#did').val(),
                        dname: $('#dname').val(),
                        dage: $('#dage').val(),
                        dnumber: $('#dnumber').val(),
                        mname: $('#mname').val(),
                        dsex: $('#dsex').val(),
                        drole: $('#drole').val(),
                        adress: $('#adress').val(),
                        deptnoid: $('#deptnoid').val(),
                    },
                    dataType: 'JSON',
                    success: function (res) {
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                    }
                });
                // 关闭弹出层
                layer.close(index);
                var iframeIndex = parent.layer.getFrameIndex(window.name);
                parent.layer.close(iframeIndex);
                // 关闭弹出层
                layer.close(index);

                var iframeIndex = parent.layer.getFrameIndex(window.name);
                parent.layer.close(iframeIndex);

            });

            return false;
        });

    });
</script>
</body>
</html>